import { approveList, approveTask, approveInfo, approveRecord } from '@/api/approval'

export default defineStore('useApproval', {
    state: () => ({}),
    getters: {},
    actions: {
        //行政审批列表
        async getApproveList(params) {
            let url = $globalRequestUrl({
                url: approveList,
            })

            try {
                const rep = await $globalRequest(url, params, { method: 'POST' })
                return rep
            } catch (error) {
                return error
            }
        },

        //审批
        async approveTask(params) {
            let url = $globalRequestUrl({
                url: approveTask,
            })

            try {
                const rep = await $globalRequest(url, params, { method: 'POST' })
                return rep
            } catch (error) {
                return error
            }
        },
        //审批
        async approveInfo(id) {
            let url = $globalRequestUrl({
                url: approveInfo + '/' + id,
            })

            try {
                const rep = await $globalRequest(url, {}, { method: 'GET' })
                return rep
            } catch (error) {
                return error
            }
        },
        //审批
        async approveRecord(id) {
            let url = $globalRequestUrl({
                url: approveRecord + '/' + id,
            })

            try {
                const rep = await $globalRequest(url, {}, { method: 'GET' })
                return rep
            } catch (error) {
                return error
            }
        },
    },
})
